filename = 'buffer://localhost:1972';
host='localhost';
port=1972;

sendTrigger(0,'DIO'); % 'DIO' or parallelport number (378)    

threshVoltage = [3 6]; %expected range of voltage for active line

hdr=read_header(filename);
begsample=hdr.nSamples+1;

for k=0:7,
    sendTrigger(2.^k);
    pause(0.1);
end
% wait 1 s
pause(1);

% read the data
hdr=read_header(filename);
tmpDat=buffer('get_dat', [begsample hdr.nSamples], host, port);

figure;
imagesc(tmpDat>threshVoltage(1) & tmpDat<threshVColtage(2));
